package org.zsl.entity;

import java.util.HashMap;

/**
 * 容器
 * */
public class BeanFactory {

    private HashMap beans;

    public void init(){

         this.beans = new HashMap();

         /**
          * <bean class="org.zsl.entity.Customer" id="customer1"></bean>
          *
          * <bean class="org.zsl.entity.Customer" id="customer1">
          *     <property name="name" value="Mat"></property>
          * </bean>
          *
          * 如何通过反射机制完成依赖注入的模拟
          * */



         this.register("customer1",new Customer());
    }

    public void register(String key,Object object){
        this.beans.put(key,object);
    }


    public  Object getBean(String key){
        return  this.beans.get(key);
    }

}
